package com.kgc.study;

public class Dog  extends Pet{
    /**
     * 特有的属性  品种
     */
    private String strain;

    public Dog() {

    }

    public Dog(String name, int health, int love, String strain) {
        super(name, health, love);
        this.strain = strain;
    }

    public String getStrain() {
        return strain;
    }

    public void setStrain(String strain) {
        this.strain = strain;
    }

    //重写方法(将父类的方法重新实现)
    @Override
    public void print() {
        System.out.println("狗狗说:");
        System.out.println("我的名字叫" + super.getName() + ",我的健康的值：" + super.getHealth() + ",我和主人亲密度是:" + super.getLove() +",我是一只" + this.getStrain());

    }


    @Override
    public void toHospital() {
        if(this.getHealth() <  50){
            System.out.println(this.getName() + "生病了，正在宠物医看病中...");
            System.out.println("治疗方法是：打针、输液 ...");
            this.setHealth(70);
            System.out.println("正在恢复中，健康值增加了" + this.getHealth());
        }
    }
}
